<c:choose xmlns:c="http://java.sun.com/jstl/core"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:util="http://code.google.com/p/ada-asf/util">
    <!-- For security reasons, check that the code parameter matches what is allowed  -->
    <c:when test="#{param['code'] eq 'if'}">
        <ui:decorate template="/WEB-INF/layouts/doc.xhtml">
            <ui:param name="name" value="c:if"/>
            <ui:define name="description">
                Simple conditional tag, which evalutes its body if the supplied condition is true
                and optionally exposes a Boolean scripting variable representing the evaluation of
                this condition.
            </ui:define>
            <ui:define name="attributes">
                <li class="attr-required">
                    <b>test</b>
                    <i>Boolean</i>
                    <span>The test condition that determines whether or not the body content should be processed.</span>
                </li>
                <li class="attr-optional">
                    <b>var</b>
                    <i>String</i>
                    <span>Name of the exported scoped variable for the resulting value of the test condition. The type of the scoped variable is Boolean.</span>
                </li>
                <li class="attr-unimpl">
                    <b>scope</b>
                    <i>String</i>
                    <span>Scope for var.</span>
                </li>
            </ui:define>
        </ui:decorate>
    </c:when>

    <c:when test="#{empty param['code'] or param['code'] eq 'set'}">
        <ui:decorate template="/WEB-INF/layouts/doc.xhtml">
            <ui:param name="name" value="c:set"/>
            <ui:define name="description">
                Sets the result of an expression evaluation based on the value of the attributes.
            </ui:define>
            <ui:define name="attributes">
                <li class="attr-required">
                    <b>var</b>
                    <i>String</i>
                    <span>Name of the variable</span>
                </li>
                <li class="attr-required">
                    <b>value</b>
                    <i>ValueExpression</i>
                    <span>Expression to be evaluated</span>
                </li>
                <li class="attr-unimpl">
                    <b>target</b>
                    <i>String</i>
                    <span>Target object whose property must be set.</span>
                </li>
                <li class="attr-unimpl">
                    <b>property</b>
                    <i>String</i>
                    <span>Name of the property to be set in the target object.</span>
                </li>
                <li class="attr-unimpl">
                    <b>scope</b>
                    <i>String</i>
                    <span>Scope for var.</span>
                </li>
            </ui:define>
        </ui:decorate>
    </c:when>

    <c:when test="#{param['code'] eq 'choose'}">
        <ui:decorate template="/WEB-INF/layouts/doc.xhtml">
            <ui:param name="name" value="c:choose"/>
            <ui:define name="description">
                Simple conditional tag that establishes a context for mutually exclusive
                conditional operations, marked by and <b>when</b> and <b>otherwise</b>.
            </ui:define>
            <ui:define name="attributes">
                <li class="attr-required">
                    <b></b>
                    <i></i>
                    <span>No attributes defined</span>
                </li>
            </ui:define>
        </ui:decorate>
    </c:when>

    <c:when test="#{param['code'] eq 'otherwise'}">
        <ui:decorate template="/WEB-INF/layouts/doc.xhtml">
            <ui:param name="name" value="c:otherwise"/>
            <ui:define name="description">
                Subtag of <b>choose</b> that follows <b>when</b> tags and runs only if all of
                the prior conditions evaluated to 'false'.
            </ui:define>
            <ui:define name="attributes">
                <li class="attr-required">
                    <b></b>
                    <i></i>
                    <span>No attributes defined</span>
                </li>
            </ui:define>
        </ui:decorate>
    </c:when>

    <c:when test="#{param['code'] eq 'when'}">
        <ui:decorate template="/WEB-INF/layouts/doc.xhtml">
            <ui:param name="name" value="c:when"/>
            <ui:define name="description">
                Subtag of <b>choose</b> that includes its body if its condition evalutes to 'true'.
            </ui:define>
            <ui:define name="attributes">
                <li class="attr-required">
                    <b>test</b>
                    <i>Boolean</i>
                    <span>The test condition that determines whether or not the body content should be processed.</span>
                </li>
            </ui:define>
        </ui:decorate>
    </c:when>

    <c:otherwise>
        <p>
            <h:outputFormat value="You have not selected the valid code: '{0}' is not recognized.">
                <f:param value="#{param['code']}"/>
            </h:outputFormat>
        </p>
    </c:otherwise>
</c:choose>